<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib prefix="sys" uri="/WEB-INF/tld/sys.tld" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>详情页面</title>
    <style type="text/css">
        .searchArea .fieldBox .label {
            width: 70px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
    </style>
    <jsp:include page="../import.jsp" flush="true"/>
</head>

<body class="iframeBody">

<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">机构名称</div>
                    <div class="field">
                        <input name="prjOrgNm" id="prjOrgNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <%--<div class="fieldBox">
                    <div class="label">支付表状态</div>
                    <div class="field">
                        <select name="payNoStatusCd" id="payNoStatusCd" data-value=" ">
                            <option value=" " seleted>全部</option>
                            <c:forEach items="${payNoStatusList }" var="kv">
                                <option value="${kv.key }">${kv.value }</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>--%>
                <div  class="fieldBox">
                    <div class="label">上报支付表状态</div>
                    <div class = "field">
                        <select name="payStatusId" id="payStatusId" data-value=" ">
                            <option value=" " seleted>全部</option>
                            <option value="4">还款中-逾期未代偿</option>
                            <option value="5">合同结束-预期已代偿</option>
                            <option value="6">还款中-逾期部分代偿</option>
                        </select>
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="formBtns notRight">
                    <span id="searchBtn" class="sq-button sq-button-round"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round"></i>清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                    <input name="parseFileRecId" id="parseFileRecId" type="hidden" value="${fgiUpDataId }">
                </div>
            </div>
        </form>
    </div>

    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null;
    var callback = null;
    var _parseFileRecId = '${fgiUpDataId}';
    var _opObjTyp = '${opObjTyp}';
    var _dataTypCd = '${dataTypCd}';
    var _opDataTabNm = '${opDataTabNm}';

    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/fgi/updetail/initList.do',
            parms: {isSuccess: 9, fgiUpDataId: _parseFileRecId},
            method: 'get',
            columns: [
                {display: '序号', name: 'id', minWidth: 120, align: 'center', enabledSort: false, hide: true},
                {display: '支付表号', name: 'payNo', minWidth: 200, align: 'center', enabledSort: false},
                {display: '客户', name: 'cstNm', width: 50, align: 'center', enabledSort: false},
                {display: '所属机构', name: 'prjOrg', width: 50, align: 'center', enabledSort: false},
                {display: '项目类型', name: 'prjType', width: 50, align: 'center', enabledSort: false},
                {
                    display: '是否资管', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if (StringUtils.isEmpty(rowdata.isCap) || rowdata.isCap == 1) {
                            return "是";
                        } else {
                            return "否";
                        }
                    }
                },
                {display: '机构名称', name: 'orgNm', width: 150, align: 'center', enabledSort: false},
                {display: '机构实际付款时间', name: 'orgPayTm', width: 150, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value){
                     return formartDate(rowdata, index, value);
                    }
                },

                {display: '支付表状态', name: 'payStatus', width: 150, align: 'center', enabledSort: false},
                {display: '上报支付表状态', name: 'payStatusNm', width: 150, align: 'center', enabledSort: false },
                {display: '开始逾期时间', name: 'overdueTm', width: 150, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value){
                        return formartDate(rowdata, index, value);
                    }
                },
                /*{
                    display: '解析状态', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if (StringUtils.isEmpty(rowdata.isSuccess) || rowdata.isSuccess == 1) {
                            return "解析成功";
                        } else {
                            return "解析失败";
                        }
                    }
                },*/
                getOptColumns(),
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
            frozen: false
        });
        grid.setHeight(500);

        $("#searchBar").ligerForm();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });


        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "dataNm": " ",
                "isSuccess": "9"
            });
        });


        callback = function () {
            grid.reload();
        };

    });

    function getOptColumns() {
        var col = {
            display: '操作',
            name: '',
            minWidth: 200,
            align: 'center',
            enabledSort: false,
            render: function (rowdata, index, value) {
                var str = "";
                if (rowdata.isNew && rowdata.isNew == 1) {
                    var g = '<a class="sq-button-hasicon" href="javascript:addOrMdfFgiUpData(';
                    g += "'" + rowdata.id + "',";
                    g += "'MDF'";
                    g += ')"><i class="sqBtnIco_4"></i>修改</a>';
                    str += g;
                }
                return str;
            }
        };
        return col;
    }

    function addOrMdfFgiUpData(_id, opTypCd) {
        var _titleNm = '修改挂靠公司星级';
        if (opTypCd && opTypCd == 'ADD') {
            _titleNm = '新增挂靠公司星级';
        }
        $.ligerDialog.SQopen({
            width: 900,
            height: 400,
            title: _titleNm,
            url: '<%=path%>/lnkrate/lnkraterelinfo/toAddPage.do?id=' + _id + '&opTypCd=' + opTypCd + '&opObjTyp=' + _opObjTyp + '&dataTypCd=' + _dataTypCd + '&opDataTabNm=' + _opDataTabNm,
            buttons: [{
                text: "保存", type: 'ok', cls: 'l-dialog-btn-ok',
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onOk = function () {}
                    if (Dialog.onOk) Dialog.onOk();
                }
            }, {
                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                    if (Dialog.onCancel) Dialog.onCancel();
                }
            }
            ]
        });
    }


    function dialogCallback() {
        $.ligerDialog.hide();
        grid.reload();
    }

    //格式化时间
    function formartDate(rowdata, index, value) {
        var dateStr = "——";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

</script>

</body>
</html>
